package com.document;

import java.io.File;

import android.content.Intent;
import android.net.Uri;

public class getFileIntent {
	 //Android获取一个用于打开PDF文件的intent     
    public static Intent getPdfFileIntent( String param ){     
  
        Intent intent = new Intent("android.intent.action.VIEW");     
        intent.addCategory("android.intent.category.DEFAULT");     
        intent.addCategory("android.intent.category.BROWSABLE");     
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
        Uri uri = Uri.fromFile(new File(param ));     
        intent.setDataAndType(uri, "application/pdf");     
        return intent;     
    }  
    //Android获取一个用于打开word文件的intent     
    public static Intent getWordFileIntent( String param ){     
  
        Intent intent = new Intent("android.intent.action.VIEW");     
        intent.addCategory("android.intent.category.DEFAULT");     
        intent.addCategory("android.intent.category.BROWSABLE");     
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
        Uri uri = Uri.fromFile(new File(param ));     
        intent.setDataAndType(uri, "application/msword");     
        return intent;     
    }  
    //Android获取一个用于打开excelF文件的intent     
    public static Intent getExcelFileIntent( String param ){     
  
        Intent intent = new Intent("android.intent.action.VIEW");     
        intent.addCategory("android.intent.category.DEFAULT");     
        intent.addCategory("android.intent.category.BROWSABLE");     
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
        Uri uri = Uri.fromFile(new File(param ));     
        intent.setDataAndType(uri, "application/vnd.ms-excel");     
        return intent;     
    }
	public static Intent getTxtFileIntent(String param) {
		 Intent intent = new Intent("android.intent.action.VIEW");     
	        intent.addCategory("android.intent.category.DEFAULT");     
	        intent.addCategory("android.intent.category.BROWSABLE");     
	        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
	        Uri uri = Uri.fromFile(new File(param ));     
	        intent.setDataAndType(uri, "text/plain");     
	        return intent;     
	}
	public static Intent gethtmlFileIntent(String param) {
		Intent intent = new Intent("android.intent.action.VIEW");     
        intent.addCategory("android.intent.category.DEFAULT");     
        intent.addCategory("android.intent.category.BROWSABLE");     
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     
        Uri uri = Uri.fromFile(new File(param ));     
        intent.setDataAndType(uri, "text/html");     
        return intent;   
	} 
	
}
